#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        int xor1 = 0;
        for (int num : nums) {
            xor1 ^= num;
        }
        uint32_t mask = 1;
        for (; (xor1 & mask) == 0; mask <<= 1);
        int xor2 = 0;
        xor1 = 0;
        for (int num : nums) {
            if ((mask & num) == 0) {
                xor1 ^= num;
            } else {
                xor2 ^= num;
            }
        }
        return {xor1, xor2};
    }
};

int main() {
    vector<int> input = {1, 2, 1, 3, 2, 5};
    Solution solution;
    vector<int> output = solution.singleNumber(input);
    for (int item : output) {
        cout << item << endl;
    }
    return 0;
}